#/usr/bin/env python
# -*- coding: utf8 -*-
# title       :
# description :
# author      :'ShenMeng'

import maya.cmds as cmds

class Checker(object):
    def __init__(self):
        self.data_dict = dict()

    def scan(self):
        self.dataDict = {}
        allMesh = cmds.ls(dag=1, v=1, type='mesh')
        cmds.select(allMesh, r=1)
        cmds.polySelectConstraint(m=3, t=8, sz=3)
        faceList = cmds.ls(sl=1)
        cmds.polySelectConstraint(m=0, t=8, sz=0)
        cmds.select(cl=1)
        for face in faceList:
            name = face.split('.f')[0]
            if name in self.dataDict:
                self.dataDict[name].append(face)
            else:
                self.dataDict[name] = [face]
        return self.dataDict

    def solve(self):
        pass

    def select(self, obj):
        # cmds.select(obj, r=1)

        if isinstance(obj, list):
            sel_list = []
            for i in obj:
                sel_list.extend(self.dataDict[i])
            cmds.select(sel_list, r=1)
        else:
            cmds.select(self.dataDict[obj], r=1)
